package cn.hbu.zlfw.research.service.impl;

import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.hbu.zlfw.common.base.service.impl.BaseServiceImpl;
import cn.hbu.zlfw.common.util.PageModel;
import cn.hbu.zlfw.common.util.Utility;
import cn.hbu.zlfw.research.dao.ResearcherDao;
import cn.hbu.zlfw.research.entity.Researcher;
import cn.hbu.zlfw.research.service.ResearcherService;

/**
 * 
 * @ClassName: ResearcherServiceImpl 
 * @Description: 科研人员service接口实现
 * @author 王鹏伟<1223443289@qq.com>
 * @date 2017年10月23日 下午5:57:42  
 * @version V1.0
 */
@Service("researcherService")
@Transactional
public class ResearcherServiceImpl extends BaseServiceImpl<Researcher, String> implements ResearcherService{
	
	@Autowired
	private ResearcherDao researcherDao;
	
	/*
	 * (non-Javadoc)
	 * @see cn.hbu.zlfw.research.service.ResearcherService#findResearcherTologin(java.lang.String, java.lang.String)
	 */
	@Override
	public Researcher findResearcherTologin(String phoneNumber, String password) {
		Map<String,Object> params=Utility.getMapInstance();
		params.put("phoneNumber", phoneNumber);
		params.put("password", password);
		return this.researcherDao.findResearcherByParams(params);
	}
	/*
	 * (non-Javadoc)
	 * @see cn.hbu.zlfw.research.service.ResearcherService#findResearcherByPhone(java.lang.String)
	 */
	@Override
	public Researcher findResearcherByPhone(String phoneNumber) {
		Map<String,Object> params=Utility.getMapInstance();
		params.put("phoneNumber", phoneNumber);
		return this.researcherDao.findResearcherByParams(params);
	}
	/*
	 * (non-Javadoc)
	 * @see cn.hbu.zlfw.research.service.ResearcherService#findResearcherByPhone(java.lang.String)
	 */
	@Override
	public Object findByPhone(String phoneNumber,Object obj) {
		Map<String,Object> params=Utility.getMapInstance();
		params.put("phoneNumber", phoneNumber);
		return this.researcherDao.findByParams(params,obj);
	}
	/*
	 * (non-Javadoc)
	 * @see cn.hbu.zlfw.research.service.ResearcherService#listResearcherByParamsToRoot(cn.hbu.zlfw.common.util.PageModel, java.lang.String, java.lang.Integer)
	 */
	@Override
	public PageModel<Researcher> listResearcherByParamsToRoot(PageModel<Researcher> pageModel, String userName,
			Integer schoolType) {
		return this.researcherDao.listResearcherByParamsToRoot(pageModel,userName,schoolType);
	}
	/*
	 * (non-Javadoc)
	 * @see cn.hbu.zlfw.research.service.ResearcherService#getResearcherToUpdate(java.lang.String, java.lang.String)
	 */
	@Override
	public Researcher getResearcherToUpdate(String phoneNumber, String id) {
		return this.researcherDao.getResearcherToUpdate(phoneNumber,id);
	}

}
